#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    FILE* pf;
    int n;
    char str[300];
    pf=fopen("test01.txt","w");
    if(pf==NULL)
    {
        perror("fopen");
        return 1;
    }
    while(scanf("%d",&n)!=EOF&&n!=0)
    {
        for(int i=0;i<n;i++)
        {
            gets(str);
            fputs(str,pf);
            fputc('\n',pf);
        }
    }
    rewind(pf);
    while(fgets(str,300,pf)!=NULL)
    {
        printf("%s",str);
    }
    fclose(pf);
    pf=NULL;
    return 0;
}
